package cn.uin.domain.shared.adapter.repository;

import java.util.Collections;
import java.util.List;

/**
 * @ClassName UnSorted
 * @Description:未排序的实现 - 表示不需要排序(使用单例模式)
 * @Author: Administrator
 * @CreateDate: 2025/11/14 17:21
 * @Version: 1.0
 */
public final class UnSorted implements ISort {

	/**
	 * 单例实例
	 */
	public static final UnSorted INSTANCE = new UnSorted();

	/**
	 * 私有构造函数，确保单例
	 */
	private UnSorted() {}

	@Override
	public List<Order> getOrders() {
		return Collections.emptyList();
	}

	@Override
	public boolean isSorted() {
		return false;
	}

	@Override
	public boolean isUnsorted() {
		return true;
	}

	@Override
	public ISort and(ISort ISort) {
		// 未排序合并任何排序都是那个排序本身
		return ISort;
	}

	@Override
	public boolean equals(Object obj) {
		return this == obj || obj instanceof UnSorted;
	}

	@Override
	public int hashCode() {
		return UnSorted.class.hashCode();
	}

	@Override
	public String toString() {
		return "UnSorted";
	}

}
